package com.yunshan.welfare.service.impl;

import com.yunshan.common.utils.DateUtils;
import com.yunshan.welfare.domain.WelfareGiftContent;
import com.yunshan.welfare.mapper.WelfareGiftContentMapper;
import com.yunshan.welfare.service.IWelfareGiftContentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 礼包内容Service业务层处理
 *
 * @author yunshan
 * @date 2025-01-20
 */
@Service
public class WelfareGiftContentServiceImpl implements IWelfareGiftContentService
{
    @Autowired
    private WelfareGiftContentMapper welfareGiftContentMapper;

    /**
     * 查询礼包内容
     *
     * @param id 礼包内容主键
     * @return 礼包内容
     */
    @Override
    public WelfareGiftContent selectWelfareGiftContentById(Long id)
    {
        return welfareGiftContentMapper.selectWelfareGiftContentById(id);
    }

    /**
     * 查询礼包内容列表
     *
     * @param welfareGiftContent 礼包内容
     * @return 礼包内容
     */
    @Override
    public List<WelfareGiftContent> selectWelfareGiftContentList(WelfareGiftContent welfareGiftContent)
    {
        return welfareGiftContentMapper.selectWelfareGiftContentList(welfareGiftContent);
    }

    /**
     * 新增礼包内容
     *
     * @param welfareGiftContent 礼包内容
     * @return 结果
     */
    @Override
    public int insertWelfareGiftContent(WelfareGiftContent welfareGiftContent)
    {
        welfareGiftContent.setCreateTime(DateUtils.getNowDate());
        return welfareGiftContentMapper.insertWelfareGiftContent(welfareGiftContent);
    }

    /**
     * 修改礼包内容
     *
     * @param welfareGiftContent 礼包内容
     * @return 结果
     */
    @Override
    public int updateWelfareGiftContent(WelfareGiftContent welfareGiftContent)
    {
        welfareGiftContent.setUpdateTime(DateUtils.getNowDate());
        return welfareGiftContentMapper.updateWelfareGiftContent(welfareGiftContent);
    }

    /**
     * 批量删除礼包内容
     *
     * @param ids 需要删除的礼包内容主键
     * @return 结果
     */
    @Override
    public int deleteWelfareGiftContentByIds(Long[] ids)
    {
        return welfareGiftContentMapper.deleteWelfareGiftContentByIds(ids);
    }

    /**
     * 删除礼包内容信息
     *
     * @param id 礼包内容主键
     * @return 结果
     */
    @Override
    public int deleteWelfareGiftContentById(Long id)
    {
        return welfareGiftContentMapper.deleteWelfareGiftContentById(id);
    }

    @Override
    public int deleteWelfareGiftContentByGiftId(Long giftId) {
        return welfareGiftContentMapper.deleteWelfareGiftContentByGiftId(giftId);
    }

    @Override
    public List<WelfareGiftContent> selectWelfareGiftContentByGiftId(Long giftId) {
        return welfareGiftContentMapper.selectWelfareGiftContentByGiftId(giftId);
    }
}
